<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="app">
        <lay_head :msgs="msg" @test="add"></lay_head>

    </div>
    <script>
        Vue.component("lay_head",{
            props:['msgs','test'],
            template:`
                <div>
                    <h3>{{msgs}}</h3>
                    <button @click="del">按钮</button>
                </div>
            `,
            methods:{
                del(){
                    console.log("ok")
                    this.$emit("test",{name:"周杰伦",age:18})

                }

            }
        })

        new Vue({
            el:"#app",
            data:{
                msg:"休息休息"

            },
            methods: {
                add(val){
                    console.log(val);
                    
                }
                
            },
        })
    </script>
    
</body>
</html>